const path = require('path');

const mimeType = {
      "css":"text/css",   
      "gif":"image/gif", 
      "html":"text/html", 
      "ico":"image/x-icon", 
      "jpeg":"image/jpeg", 
      "jpg":"image/jpeg", 
      "js":"text/javascript", 
      "json":"application/json", 
      "pdf":"application/pdf", 
      "png":"image/png", 
      "svg":"image/svg+xml", 
      "swf":"application/x-shockwave-flash", 
      "tiff":"image/tiff", 
      "txt":"text/plain", 
      "wav":"audio/x-wav", 
      "wma":"audio/x-ms-wma", 
      "wmv":"video/x-ms-wmv", 
      "xml":"text/xml",   
}

module.exports = (filePath)=>{
      let ext = path.extname(filePath)
      .split('.')
      .pop()
      .toLowerCase();
      if (!ext) {
            ext = filePath
      }
      console.log(mimeType[ext])
      return mimeType[ext]||mimeType['txt']
}